package com.hpeu_12.zuoye1229;

import java.util.Arrays;
import java.util.Scanner;

/*
 * 输入10个整数存入数组，然后采冒泡排序后将其输出。
 */
public class Test05 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] arr = new int[10];
		for (int i = 0; i < arr.length; i++) {
			System.out.println("请输入第"+(i+1)+"个整数：");
			arr[i] = scanner.nextInt();
		}
		
		//冒泡排序算法
		for (int i = 0; i < arr.length-1; i++) {
			for (int j = 0; j < arr.length-1-i; j++) {
				if (arr[j] > arr[j+1]) {
					int temp = arr[j];
					arr[j] = arr[j+1];
					arr[j+1] = temp;
				}
			}
		}
		//输出
		System.out.println(Arrays.toString(arr));
	}
}
